#!/bin/sh

read -p "请确认是否提交代码 y/n ? :" isPush

if test $isPush = "y"
then
    branch=$(git symbolic-ref --short -q HEAD)
    read -p "请输入代码提交备注内容:" content
    git add -A
    git commit -m"$content"

    exitCode="$?"

    if [ $exitCode == 0 ]
    then
        git push --set-upstream origin $branch
    else
        read -p "请先处理报错 exited with code $exitCode (error), ctrl+c 退出:"
    fi
else
    exit 0
fi

exit $?
